var AutoRenderControls = new Array();
var AutoRenderErrors = true;

function addEvent(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, true); 
		return true; 
	} else if (obj.attachEvent){ 
		return obj.attachEvent("on" + evType, fn); 
	} else return false;
}

function renderUserError(ctrl) {
	el = document.getElementById(ctrl); 
	if (el!=null) {
		document.getElementById(ctrl).className = 'errorStyle';
	}
}

function addControlToErrorRender(ctrl) {
	var controls = ctrl.split(";");
	for (i=0; i<controls.length; i++) {
		AutoRenderControls[AutoRenderControls.length] = controls[i];
	}
}

function onLoadHandler() {
	for (var i=0; i<AutoRenderControls.length; i++) {
		renderUserError(AutoRenderControls[i]);
	}
}

addEvent(window, 'load', onLoadHandler);

function togglelayer(id) {
	if (document.getElementById(id).style.display=='none' ){
		document.getElementById(id).style.display = '';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

function showlayer(id) {
	var lyr = document.getElementById(id);
	if (lyr != null) document.getElementById(id).style.display = '';
}

function hidelayer(id) {
	var lyr = document.getElementById(id);
	if (lyr != null) document.getElementById(id).style.display = 'none';
}
